home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / Snippets / Platforms & Tools / MacApp / MouseInfo 1.0 / UMouseDocument.cp < prev    next >
Encoding:
Text File  |  1992-04-29  |  1.6 KB  |  70 lines  |  [TEXT/MPS ]

  1. //     UMouseDocument.cp 
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMouseDocument member functions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8.  
  9.  
  10. // INCLUDES
  11. #ifndef __MOUSEDOCUMENT__
  12. #include "UMouseDocument.h"                                    // class definitions
  13. #endif
  14.  
  15.  
  16. //    CLASS METHODS 
  17. //    Empty constructor - for avoiding ptabs in global data space
  18. #pragma segment ARes
  19. TMouseDocument::TMouseDocument()
  20. {
  21. }
  22.  
  23.  
  24. //    Create TMouseDocument
  25. #pragma segment AInit
  26. pascal void TMouseDocument::IMouseDocument()
  27. {
  28.     inherited::IDocument();
  29. }
  30.  
  31.  
  32. //    Free any resources attached to the TMouseDocument - yes it's empty, but one never
  33. //    knows if one could place something here, so I have it added. Yes, it wastes CPU
  34. //    cycles...
  35. #pragma segment AClose
  36. pascal void TMouseDocument::Free()
  37. {
  38.     inherited::Free();
  39. }
  40.  
  41.  
  42. //    Create any needed TMouseDocument Views
  43. #pragma segment AOpen
  44. pascal void TMouseDocument::DoMakeViews(Boolean    /*forPrinting*/)
  45. {
  46.     TWindow * aWindow = NULL;
  47.     FailInfo fi;
  48.  
  49.     if (fi.Try())
  50.     {
  51.         // create main information window    
  52.         aWindow = (TWindow *)gViewServer->NewTemplateWindow(kMainWindow, this);
  53.         fMainView = (TView *)aWindow->FindSubView('vie1');
  54.  
  55.         // add frame adorner for the document
  56.         fMainView->AddAdorner(NewStdAdorner('afra', "", 'afra', kFreeOnDeletion), kDrawView, kRedraw);
  57.  
  58.         //    add mouse tracking behaviors
  59.         TMouseTrackBehavior * theBehavior = new TMouseTrackBehavior;
  60.         theBehavior->IMouseTrackBehavior(mMouseTrack);
  61.         this->AddBehavior(theBehavior);
  62.  
  63.         fi.Success();
  64.     }
  65.     else
  66.         fi.ReSignal();
  67. }
  68.  
  69.  
  70.